	var isFinish = false;
	function GameOver() {

		window.clearInterval(gameRunStateTimer);
		RemoveRemianTimer();
		if(isFinish)
		{
			return ;
		}
		var btnArray = ['是'];
		SetMarquee("本局游戏已经结束");
		var message = '本局游戏已结束,确定后返回。';
		isFinish = true;
		PlaySound("over");
		mui.confirm(message, '信息提示', btnArray, function(e) {
				  ConfirmGameOver();
				
		 },'div');
		
	}
	
	function Back() {
		if(!isTest)
		{
			window.location.href = "uniwebview://Back?num=1";
		}
		
	}
	
	function ConfirmGameOver() {
		if(!isTest)
		{
			window.location.href = "uniwebview://GameOver?num=1";
		}
		
	}
			
	//播放游戏已结束的提示
	function PlayFinshSound()
	 {
		 if(!isTest)
		 {
			  window.location.href = "uniwebview://PlayFinshSound?num=1";
		 }
		
	 }

	var gameRunStateTimer;
	///检查游戏状态
	function TimerGetGameRunState(userid,userType,ip)
	{
		
		if(!isFinish)
		{
			gameRunStateTimer = setInterval(function() {
				setTimeout(function() {
					/* if(!isTest)
					{
						window.location.href = "uniwebview://CheckGameRunState?num=1";
					} */
					
					StartCheck(userid,userType,ip);
					
				},1000)
				},2000)
		}
		
	}
	
	function StartCheck(userId,userType,ip)
	{
		
		if(!isTest)
		{
			var requestUrl = "http://"+ ip + ":8899/CheckGameRunState/" + userId + "|" + userType;
			
			axios.get(requestUrl)
				.then(function (response) {
					
					if(response.data!=0)
					{
						GameOver();
					}
				})
				.catch(function (error) {
					console.log(error);
					//mui.alert('操作异常');
				});
		}
		
	}